Skip to content

Conversation

nsingh-branch
Copy link
Contributor

Summary

When a BranchEvent is logged on first open before the SDK is initialized, we try to initialize first to log it properly. However, the SDK was reaching a state where processNextQueueItem was stuck and unable to process the first install or the event and nothing would happen until the next session. It seems like this was due to the BranchEvent request basically causing the queue to get stuck and the SDK to stay in an initializing state since processNextQueueItem would be skipped networkCount wasn't equal to 0.
This change updates the if statement to also set the networkCount to 0 which allows the install to be processed and then the event to be processed after that. Since this statement only applies to non-install or open events on the first session, this change shouldn't have an effect on other cases.

Motivation

Fix for a bug, mainly for the Adobe Branch plugin, but other clients may be trying to log events early in some cases as well.

Type Of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing Instructions

Try out the updated testbed which logs an event from the AppDelegate before the SDK is initialized.

cc @BranchMetrics/saas-sdk-devs for visibility.


BranchEvent *earlyEvent = [BranchEvent standardEvent:BNCAddToCartEvent];
NSLog(@"Logging Early Event: %@", earlyEvent);
[earlyEvent logEvent];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to queue an event before the sdk is initialized?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah

@ahmednawar
Copy link
Contributor

@nsingh-branch what's the next step here? cc @gdeluna-branch

@gdeluna-branch
Copy link
Contributor

@NidhiDixit09 will take this pr @ahmednawar

@NidhiDixit09 NidhiDixit09 merged commit 5a93956 into master Jan 31, 2025
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants